Next: Basic Help, Previous: Basic Undo, Up: Basic [Contents][Index]
Text that you insert in an Emacs buffer lasts only as long as the Emacs session. To keep any text permanently, you must put it in a file.
Suppose there is a file named test.emacs in your home directory. To begin editing this file in Emacs, type
C-x C-f test.emacs RET
Here the file name is given as an argument to the
command C-x C-f (find-file). That command
uses the minibuffer to read the argument, and you type
RET to terminate the argument (see Minibuffer).
Emacs obeys this command by visiting the file: it
creates a buffer, copies the contents of the file into the
buffer, and then displays the buffer for editing. If you alter
the text, you can save the new text in the file by
typing C-x C-s (save-buffer). This copies
the altered buffer contents back into the file
test.emacs, making them permanent. Until you save,
the changed text exists only inside Emacs, and the file
test.emacs is unaltered.
To create a file, just visit it with C-x C-f as if it already existed. This creates an empty buffer, in which you can insert the text you want to put in the file. Emacs actually creates the file the first time you save this buffer with C-x C-s.
To learn more about using files in Emacs, see Files.